﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ListOfStudentsInFile
{
    class Student
    {
        private string dataPath = @"E:\с#\Codeplex\Inteducation\apetrenko\ListOfStudentsInFile\ListOfStudents.txt";
        private int studentID;
        private string firstName;
        private string lastName;
        private string fullInfoOfStudent;
        private string choise;
        private Random rnd = new Random();
        //private List<String> listOfStudents = new List<String>();

        public void addCredential()
        {
            do
            {
                Console.WriteLine("Введите имя студента");
                firstName = Console.ReadLine();
                Console.WriteLine("Введите фамилию студента");
                lastName = Console.ReadLine();
                studentID = rnd.Next(100, 999);
                fullInfoOfStudent = studentID + " " + firstName + " " + lastName + Environment.NewLine;
                File.AppendAllText(dataPath, fullInfoOfStudent);
                Console.WriteLine("Добавить еще студента? Д/Н");
                choise = Console.ReadLine();
            }
            while (choise == "Д" || choise == "д");
        }
        //public int ID
        //{
        //    set
        //    {
        //        studentID =;
        //    }
        //    get { return studentID; }
        //}
        public void showStudent()
        {
            string ListFromFile = File.ReadAllText(dataPath);
            Console.WriteLine(ListFromFile);
        }
    }
}
